package com.asset.dispoal.dicData.service.commom;

import com.asset.dispoal.dicData.domain.db.mapper.GbDictDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.mhuang.pacebox.core.ddd.BaseCommand;
import tech.mhuang.pacebox.core.util.StringUtil;
import tech.mhuang.pacebox.springboot.protocol.Result;

/**
 * @author qr
 * @date 2022/2/25$
 */
@Component
public class DeleteDictDataCommand implements BaseCommand<String, Result> {

    @Autowired
    GbDictDataMapper gbDictDataMapper;

    @Override
    public Result execute(String id) {
        if (StringUtil.isBlank(id)) {
            return Result.faild("数据不存在");
        }
        gbDictDataMapper.delete(id);
        return Result.ok();
    }
}
